#!/usr/bin/python

"""
pyPaSWAS:
This program performs a Smith-Waterman alignment of all sequences in the first file against all sequences in the second file

Handle argument parsing for main.py.
Requires Python version >= 2.7.
If you have Python 2.6, you can manually add argparse as a standalone Module.

@requires: sys
@requires" argparse
"""

import sys
import argparse

def parse() :
    """
    Parse the command line, do all necessary checks and return the arguments
    as a dictionary.
    
    Auto generated by:
        CLI-mate (0.3)      
        2012-10-04T20:27:17.524537Z

    Based on:
        RDF Definition of "pyPaSWAS"                                               
        2012-10-04T20:27:17.524294Z                                                

    @returns: An object with the parsed arguments.
    @rtype: argparse.Namspace
    """
    
    parser = argparse.ArgumentParser(
            prog='python pypaswasall.py',
            formatter_class=argparse.RawDescriptionHelpFormatter,
            description='This program performs a Smith-Waterman alignment of all sequences in the first file against all sequences in the second file',
            epilog="""""")
    
    parser.add_argument('-i', '--input', dest='input', type=argparse.FileType('r'),             
            help='Input FASTA file')
    parser.add_argument('-o', '--output', dest='output', type=argparse.FileType('w'), default='./output',             
            help='Output file to store generated SAM output')
    parser.add_argument('--anyScore', dest='anyScore', type=int, default=2,             
            help='Any score..')
    parser.add_argument('--otherScore', dest='otherScore', type=int, default=1,             
            help='Other score..')
    parser.add_argument('--minimum', dest='minimumScore', type=int, default=500,             
            help='Minimum score initiating a back trace')
    parser.add_argument('--highestScore', dest='highestScore', type=int, default=5,             
            help='Sets the highest score that...')
    parser.add_argument('--llimitMaxScore', dest='llimitMaxScore', type=bool, nargs='?', default=False, const=True,             
            help='Sets the lower limit maximum score')
    parser.add_argument('--device', dest='device', type=int, default=0,             
            help='The device to use for computations')
    parser.add_argument('--filterfactor', dest='filterFactor', type=float, default=0.7,             
            help='The filter factor to be used')
    parser.add_argument('--limitlength', dest='limitlength', type=int, default=5000,             
            help='Sets a limit to the maximal length of items to be compared at one time')
    parser.add_argument('--numberOfJobs', dest='numberOfJobs', type=bool, nargs='?', default=False, const=True,             
            help='Sets the number of jobs to run simultaneously')
    parser.add_argument('--processID', dest='processID', type=bool, nargs='?', default=False, const=True,             
            help='Sets the process ID')
    parser.add_argument('-L', '--loglevel', dest='logfile', type=argparse.FileType('w'),             
            help='File to log events to')
    parser.add_argument('--maxGenomeLength', dest='maxGenomeLength', type=bool, nargs='?', default=False, const=True,             
            help='Sets the maximum length of (the part of) the sequence that will be processed at one time')
    parser.add_argument('--loglevel', dest='loglevel', type=str, default='WARNING',             
            help='Level of events logged to logfile')
    parser.add_argument('-p', '--program', dest='program', type=str, default='aligner',             
            help='The program to be executed')
    parser.add_argument('--customMatrix', dest='customMatrix', type=argparse.FileType('r'),             
            help='Custom matrix that should be used')
    parser.add_argument('--gap', dest='gapPenalty', type=int, default=-5,             
            help='Penalty for a gap')
    parser.add_argument('-M', '--matrixname', dest='matrixname', type=str, default='DNA-RNA',             
            help='The scoring to be used')
    parser.add_argument('-q', '--mismatch', dest='mismatchPenalty', type=bool, nargs='?', default=False, const=True,             
            help='Penalty for a mismatch')
    parser.add_argument('-r', '--matchScore', dest='matchScore', type=int, default=5,             
            help='Reward for a match')
    
    
    arguments = parser.parse_args()
    
    return arguments
#parse

################################################################################
# usage example
#
def main():
   arguments = parse()
#   
#   # Your program logic here. 
#   # Use arguments.<arg_name> to access an argument
# 
#def main
#
if __name__ == "__main__": 
   main()
################################################################################
